how to convert object to array in javascript